*REPLICATION DO-FILE FOR BARTUSEVICIUS AND GLEDITSCH. A TWO-STAGE APPROACH TO CIVIL CONFLICT. INTERNATIONAL ORGANIZATION
*All the files needed for the replication analyses below are in the downloaded replication folder. 
*To directly run the replications, keep all the data files together with the current do-file in the same folder.  
clear
version 14.0

*set working directory* 


*Replicate original BCG (2014) Model 2 (Table 1)

*Download the original data from: https://www.prio.org/Publications/Publication/?x=7414
*Load the original data 
use "BCG_squarepegs.dta", clear
set more off
xtset cowcode year

*Direct commands from BCG_squarepegs.do:
// Macros for standardized control variables
global CONTROLS1 downatall powershare sip2l lpopl lgdpcapl 
global CONTROLS2 sip2l lpopl lgdpcapl 
global CONTROLS3 powershare sip2l lpopl lgdpcapl 
// Macros for standardized time controls
global TIME1 incidencel
global TIME2 mpyrs mspline*
global TIME3 warlfl
global TIME4 fpeaceyears fspline*
global TIME5 conflictl
global TIME6 flnewpeacey
global TIME7 fl_newcwlag
*Model 2: Adding measures of pol. and econ. HIs
logit onset01 ethfrac mgini_intx max_rdisc maxhighx maxlowx $CONTROLS1 $TIME1 if year>=1960, cl(cowcode) nolog

*Or:
logit onset01 ethfrac mgini_intx max_rdisc maxhighx maxlowx downatall powershare sip2l lpopl lgdpcapl incidencel if year>=1960, cl(cowcode) nolog
*Results: Identic
estimates store t2col1

*Replicate BCG (2014) Model 2 (Table 1) with full time-span
logit onset01 ethfrac mgini_intx max_rdisc maxhighx maxlowx downatall powershare sip2l lpopl lgdpcapl incidencel, cl(cowcode) nolog
*Results: Very similar (thus, we can use this specification)
estimates store t2col2

*Replicate BCG (2014) Model 2 (Table 1), full time-span, with CONIAS data
*Load CONIAS data
merge 1:1 cowcode year using "merge.dta"
xtset cowcode year
*Replicate
logit cac_ons35_b ethfrac mgini_intx max_rdisc maxhighx maxlowx downatall powershare sip2l lpopl lgdpcapl l.cac_inc35_b, cl(cowcode) nolog
estimates store t2col3
*Results: Similar (p-values for maxlow and downatall above 10% level; for all other variables: similar estimates)

*Replicate BCG (2014) Model 2 (Table 1), full time-span, using Heckman selection probit
*Population size (lpopl) as identifying condition for onset of incompatibilities (Stage 1)
heckprobit cac_ons35_b ethfrac mgini_intx max_rdisc maxhighx maxlowx downatall powershare sip2l lgdpcapl l.cac_inc35_b, cl(cowcode) nolog ///
  select (cci_ons_b = ethfrac mgini_intx max_rdisc maxhighx maxlowx downatall powershare sip2l lpopl lgdpcapl l.cci_inc_b)
*Results: rho = .1801468; not significant; lpopl and maxrdisc significant positive in Stage 1 but not in Stage 2
estimates store t2col4

margins, dydx(*) pred(pmargin)
margins, dydx(*) pred(psel)
margins, dydx(*) pred(pcond)

*Descriptives for DV
tab cac_ons35_b if e(sample) & cci_inc_b==1
tab cci_ons_b if e(sample) 

*Approximate F tests
reg cci_ons_b ethfrac mgini_intx max_rdisc maxhighx maxlowx downatall powershare sip2l lpopl lgdpcapl l.cci_inc_b
test lpopl
*F 35+, which is above 10

*Add population size to Stage 2
heckprobit cac_ons35_b ethfrac mgini_intx max_rdisc maxhighx maxlowx downatall powershare sip2l lpopl lgdpcapl l.cac_inc35_b, cl(cowcode) nolog ///
  select (cci_ons_b = ethfrac mgini_intx max_rdisc maxhighx maxlowx downatall powershare sip2l lgdpcapl l.cci_inc_b)
*Population size not significant in Stage 2; rho = 1; "initial values not feasible"

*Replicate BCG (2014) Model 2 (Table 1), full time-span, using 2PM
logit cci_ons_b ethfrac mgini_intx max_rdisc maxhighx maxlowx downatall powershare sip2l lpopl lgdpcapl l.cci_inc_b
estimates store selection
logit cac_ons35_b ethfrac mgini_intx max_rdisc maxhighx maxlowx downatall powershare sip2l lpopl lgdpcapl l.cac_inc35_b if cci_inc_b == 1
estimates store outcome
suest selection outcome, cluster(cowcode)
*Results: max_rdisc, lpopl only affect Stage 1; lgdpcapl only affects Stage 2
est store t2col5

*Replicate BCG (2014) Model 2 (Table 1), full time-span, using 2PM and CONIAS 4-5 categories
logit cci_ons_b ethfrac mgini_intx max_rdisc maxhighx maxlowx downatall powershare sip2l lpopl lgdpcapl l.cci_inc_b
estimates store selection
logit cac_ons45_b ethfrac mgini_intx max_rdisc maxhighx maxlowx downatall powershare sip2l lpopl lgdpcapl l.cac_inc45_b if cci_inc_b == 1
estimates store outcome
suest selection outcome, cluster(cowcode)
*Results: max_rdisc, lpopl only affect Stage 1; lgdpcapl only affects Stage 2
est store t2col6

*Replicate BCG (2014) Model 2 (Table 1), full time-span, using 2PM and NAVCO campaigns
logit nci_ons_b ethfrac mgini_intx max_rdisc maxhighx maxlowx downatall powershare sip2l lpopl lgdpcapl l.nci_inc_b
estimates store selection
logit nac_ons_b ethfrac mgini_intx max_rdisc maxhighx maxlowx downatall powershare sip2l lpopl lgdpcapl l.nac_inc_b if nci_inc_b == 1
estimates store outcome
suest selection outcome, cluster(cowcode)
*Results: given different conceptualization, surprisingly similar: max_rdisc, lpopl only affect Stage 1; lgdpcapl only affects Stage 2
est store t2col7

*Write out Table 2
esttab t2col1 t2col2 t2col3 t2col4 t2col5 t2col6 t2col7 using tables.rtf, aic se star(+ 0.10 * 0.05 ** 0.01 *** 0.001) b(%9.3f) onecell nogaps unstack replace ///
nodepvars nonumbers eqlabels(none) coeflabel(ethfrac ELF mgini_intx Gini max_rdisc LDG maxhighx PHI maxlowx NHI downatall Downgrade ///
powershare Power-sharing sip2l Democracy lpopl Population lgdpcapl "GDP per capita" /// 
_cons Constant) mlabels ("Original BCG" "Expanded BCG" "Expanded BCG CONIAS" "Heckman CONIAS 3-5" "2PM CONIAS 3-5" /// 
"2PM CONIAS 4-5" "2PM NAVCO") addnotes ("Variables accounting for time-dependence (i.e., one year dependent variable lags) not reported") ///
drop(incidencel L.cac_inc35_b L.cac_inc45_b L.cci_inc_b L.nci_inc_b L.nac_inc_b) ///
title ("Table 2. Replication of Buhaug, Cederman, and Gleditsch (2014) using the two-stage approach")

*Plot marginal effects on the two stages
*Max discrimination
logit cac_ons35_b ethfrac mgini_intx max_rdisc maxhighx maxlowx downatall powershare sip2l lpopl lgdpcapl l.cac_inc35_b, cluster(cowcode)
sum max_rdisc
margins, atmeans at(max_rdisc=(0(0.0515789473684211)0.98))
marginsplot, scheme(s1mono) title(Dichotomous model) ytitle("") xlabel(#8) xtitle(Largest discriminated group) ///  
ylabel(0(0.03)0.18)recastci(rarea) ciopts(fcolor(gs13) lcolor(gs13)) recast(line) ///
name(one, replace)

logit cci_ons_b ethfrac mgini_intx max_rdisc maxhighx maxlowx downatall powershare sip2l lpopl lgdpcapl l.cci_inc_b, cluster(cowcode)
margins, atmeans at(max_rdisc=(0(0.0515789473684211)0.98))
marginsplot, scheme(s1mono) title(Stage 1) ytitle("") xlabel(#8) xtitle(Largest discriminated group) ///  
ylabel(0(0.03)0.18)recastci(rarea) ciopts(fcolor(gs13) lcolor(gs13)) recast(line) ///
name(two, replace)

logit cac_ons35_b ethfrac mgini_intx max_rdisc maxhighx maxlowx downatall powershare sip2l lpopl lgdpcapl l.cac_inc35_b if cci_inc_b == 1, cluster(cowcode)
margins, atmeans at(max_rdisc=(0(0.0515789473684211)0.98))
marginsplot, scheme(s1mono) title(Stage 2) ytitle("") xlabel(#8) xtitle(Largest discriminated group) ///  
ylabel(0(0.03)0.18)recastci(rarea) ciopts(fcolor(gs13) lcolor(gs13))  recast(line) ///
name(three, replace)

*Produce Figure 1
graph combine one two three, ysize(3) xsize(9) scheme(s1mono) col(3) iscale(1)
graph save figure1, replace



*Replicate SG (2006) (Table 3)

*Download the original data from: https://dataverse.harvard.edu/dataset.xhtml?persistentId=hdl:1902.1/10217
*Load the original data 
use "IOrepdata.dta", clear
xtset ccode year

*Direct commands from ReplicationFile.txt:
logit nonset logref2 nbcwbin ethnicnb polityb polityb2 lngdp lnpop het peace1 s1a s2a s3a, robust nolog
*Results: identic
est store t3col1

*Replicate using CONIAS data

*Rename COW code to match that in merge.dta
rename ccode cowcode

*Load CONIAS variables
merge 1:1 cowcode year using "merge.dta"
xtset cowcode year

*Generate peace years with splines for CONIAS contested incompatibilities and armed conflict
*Requires package btscs (can be downloaded from: https://www.prio.org/Data/Stata-Tools/)
btscs cci_inc_b year cowcode if year > 1949 & year < 2002, g(pcyrs_cci) nspline(3)
rename (_spline1 _spline2 _spline3) (_spline1_cci _spline2_cci _spline3_cci)
btscs cac_inc35_b year cowcode if year > 1949 & year < 2002, g(pcyrs_cac35) nspline(3)
rename (_spline1 _spline2 _spline3) (_spline1_cac35 _spline2_cac35 _spline3_cac35)
btscs cac_inc45_b year cowcode if year > 1949 & year < 2002, g(pcyrs_cac45) nspline(3)
rename (_spline1 _spline2 _spline3) (_spline1_cac45 _spline2_cac45 _spline3_cac45)

*Replicate 
logit cac_ons35 logref2 nbcwbin ethnicnb polityb polityb2 lngdp lnpop het pcyrs_cac35 _spline1_cac35 _spline2_cac35 _spline3_cac35 if nonset != . , robust nolog
*Results: reasonably similar
est store t3col2

*Replicate using Heckman selection probit
*Population size (lpopl) as identifying condition for onset of incompatibilities (Stage 1)
heckprobit cac_ons35_b logref2 nbcwbin ethnicnb polityb polityb2 lngdp het pcyrs_cac35 _spline1_cac35 _spline2_cac35 _spline3_cac35 if nonset != ., robust nolog ///
  select (cci_ons_b = logref2 nbcwbin ethnicnb polityb polityb2 lngdp lnpop het pcyrs_cci _spline1_cci _spline2_cci _spline3_cci)
*Results: rho = .4192304; not significant; logref2 only significant in Stage 2;  lnpop only significant in Stage 1
estimates store t3col3

*Add population size to Stage 2
heckprobit cac_ons35_b logref2 nbcwbin ethnicnb polityb polityb2 lngdp lnpop het pcyrs_cac35 _spline1_cac35 _spline2_cac35 _spline3_cac35 if nonset != ., robust nolog ///
  select (cci_ons_b = logref2 nbcwbin ethnicnb polityb polityb2 lngdp het pcyrs_cci _spline1_cci _spline2_cci _spline3_cci)
*Results: rho = .9803447; not significant

*Replicate using 2PM
logit cci_ons_b logref2 nbcwbin ethnicnb polityb polityb2 lngdp lnpop het pcyrs_cci _spline1_cci _spline2_cci _spline3_cci if nonset != .
est store selection
logit cac_ons35_b logref2 nbcwbin ethnicnb polityb polityb2 lngdp lnpop het pcyrs_cac35 _spline1_cac35 _spline2_cac35 _spline3_cac35 if cci_inc_b == 1 & nonset != .
est store outcome
suest selection outcome, robust
*Results: refugees and ethnicnb only significant in Stage 2
est store t3col4

*Write out Table 3
esttab t3col1 t3col2 t3col3 t3col4 using tables.rtf, aic se star(+ 0.10 * 0.05 ** 0.01 *** 0.001) b(%9.3f) onecell nogaps unstack append ///
nodepvars nonumbers eqlabels(none) coeflabel (logref2 Refugees nbcwbin "Civil war in neighbor" ethnicnb "Ethnic kin" polityb Polity polityb2 "Polity squared" ///
lngdp "GDP per capita" lnpop "Population" het "Ethnic heterogeneity" peace1 "Peace years" _cons Constant) mlabels ("Original SG" "SG CONIAS 3-5" "Heckman CONIAS 3-5" /// 
"2PM CONIAS 3-5") addnotes ("Peace years and splines not reported") drop(peace1 s1a s2a s3a pcyrs_cac35 _spline1_cac35 _spline2_cac35 _spline3_cac35 ///
pcyrs_cci _spline1_cci _spline2_cci _spline3_cci) ///
title ("Table 3. Replication of Salehyan and Gleditsch (2006) using the two-stage approach")

*Plot marginal effects on the two stages
*Max discrimination
logit cac_ons35 logref2 nbcwbin ethnicnb polityb polityb2 lngdp lnpop het pcyrs_cac35 _spline1_cac35 _spline2_cac35 _spline3_cac35 if nonset != . , robust
sum logref2
margins, atmeans at(logref2=(0(0.8051710526315789)15.29825))   
marginsplot, scheme(s1mono) title(Dichotomous model) ytitle("") xlabel(#4) xtitle(Refugees (ln)) ///  
ylabel(0(0.04)0.20)recastci(rarea) ciopts(fcolor(gs13) lcolor(gs13))  recast(line) ///
name(four, replace)

logit cci_ons_b logref2 nbcwbin ethnicnb polityb polityb2 lngdp lnpop het pcyrs_cci _spline1_cci _spline2_cci _spline3_cci if nonset != ., robust
margins, atmeans at(logref2=(0(0.8051710526315789)15.29825)) 
marginsplot, scheme(s1mono) title(Stage 1) ytitle("") xlabel(#4) xtitle(Refugees (ln)) ///  
ylabel(0(0.04)0.20)recastci(rarea) ciopts(fcolor(gs13) lcolor(gs13)) recast(line) ///
name(five, replace)

logit cac_ons35_b logref2 nbcwbin ethnicnb polityb polityb2 lngdp lnpop het pcyrs_cac35 _spline1_cac35 _spline2_cac35 _spline3_cac35 if cci_inc_b == 1 & nonset != ., robust
margins, atmeans at(logref2=(0(0.8051710526315789)15.29825)) 
marginsplot, scheme(s1mono) title(Stage 2) ytitle("") xlabel(#4) xtitle(Refugees (ln)) ///  
ylabel(0(0.04)0.20)recastci(rarea) ciopts(fcolor(gs13) lcolor(gs13)) recast(line) ///
name(six, replace)



*Replicate Warren (2014) (Table 4)

*Download the original data from: http://iojournal.org/not-by-the-sword-alone-soft-power-mass-media-and-the-production-of-state-sovereignty/
*Load the original data 
use "Warren_IO_reg_data.dta", clear
xtset cowcode year

*Direct commands from Warren_IO_regs.do:
logit onset mdi lgdpl larea lmtn lpopl oil2l deml deml2 ethfracl relfracl pcyrs spline1 spline2 spline3, cluster(cowcode)
*Results: identic
est store t4col1

*Replicate using CONIAS data

*Load CONIAS variables
merge 1:1 cowcode year using "merge.dta"
xtset cowcode year

*Generate peace years with splines for CONIAS contested incompatibilities and armed conflict
btscs cci_inc_b year cowcode if year < 2000, g(pcyrs_cci) nspline(3)
rename (_spline1 _spline2 _spline3) (_spline1_cci _spline2_cci _spline3_cci)
btscs cac_inc35_b year cowcode if year < 2000, g(pcyrs_cac35) nspline(3)
rename (_spline1 _spline2 _spline3) (_spline1_cac35 _spline2_cac35 _spline3_cac35)
btscs cac_inc45_b year cowcode if year < 2000, g(pcyrs_cac45) nspline(3)
rename (_spline1 _spline2 _spline3) (_spline1_cac45 _spline2_cac45 _spline3_cac45)

*Replicate 
logit cac_ons35 mdi lgdpl larea lmtn lpopl oil2l deml deml2 ethfracl relfracl pcyrs_cac35 _spline1_cac35 _spline2_cac35 _spline3_cac35 if onset != ., cluster(cowcode)
*Results: similar
est store t4col2

*Replicate using CONIAS 4-5 categories
logit cac_ons45 mdi lgdpl larea lmtn lpopl oil2l deml deml2 ethfracl relfracl pcyrs_cac45 _spline1_cac45 _spline2_cac45 _spline3_cac45 if onset != ., cluster(cowcode)
est store t4col3
*Results: more similar (thus, use CONIAS 4-5)

*Replicate using Heckman selection probit and CONIAS 4-5
*Population size (lpopl) as identifying condition for onset of incompatibilities (Stage 1)
heckprobit cac_ons45_b mdi lgdpl larea lmtn oil2l deml deml2 ethfracl relfracl pcyrs_cac45 _spline1_cac45 _spline2_cac45 _spline3_cac45 if onset != ., cluster(cowcode) ///
  select (cci_ons_b = mdi lgdpl larea lmtn lpopl oil2l deml deml2 ethfracl relfracl pcyrs_cci _spline1_cci _spline2_cci _spline3_cci)
*Results: rho = -.0446508; not significant; lgdpl only significant in Stage 2;  lnpop only significant in Stage 1; both deml deml2 only sinificant in Stage 2
estimates store t4col4

*Replicate using 2PM and CONIAS 4-5 categories
logit cci_ons_b mdi lgdpl larea lmtn lpopl oil2l deml deml2 ethfracl relfracl pcyrs_cci _spline1_cci _spline2_cci _spline3_cci if onset != .
est store selection
logit cac_ons45_b mdi lgdpl larea lmtn lpopl oil2l deml deml2 ethfracl relfracl pcyrs_cac45 _spline1_cac45 _spline2_cac45 _spline3_cac45 if cci_inc_b == 1 & onset != .
est store outcome
suest selection outcome, cluster(cowcode)
*Results: similar
est store t4col5

*Write out Table 4
esttab t4col1 t4col2 t4col3 t4col4 t4col5 using tables.rtf, aic se star(+ 0.10 * 0.05 ** 0.01 *** 0.001) b(%9.3f) onecell nogaps unstack append ///
nodepvars nonumbers eqlabels(none) coeflabel (mdi "Media Density Index" lgdpl "GDP per capita" larea "Area" lmtn "Mountanous terrain" lpopl Population /// 
oil2l "Oil exporter" deml Democracy deml2 "Democracy squared" ethfracl "Ethnic fractionalization" relfracl "Religious fractionalization" ///
pcyrs "Peace years" _cons Constant) mlabels ("Original Warren" "Warren CONIAS 3-5" "Warren CONIAS 4-5" "Heckman CONIAS 4-5" /// 
"2PM CONIAS 4-5") addnotes ("Peace years and splines not reported") ///
drop(pcyrs spline1 spline2 spline3 pcyrs_cci _spline1_cci _spline2_cci _spline3_cci pcyrs_cac35 _spline1_cac35 _spline2_cac35 _spline3_cac35 /// 
pcyrs_cac45 _spline1_cac45 _spline2_cac45 _spline3_cac45) ///
title ("Table 4. Replication of Warren (2014) using the two-stage approach")

*Plot marginal effects on the two stages
*max discrimination
logit cac_ons45 mdi lgdpl larea lmtn lpopl oil2l deml deml2 ethfracl relfracl pcyrs_cac45 _spline1_cac45 _spline2_cac45 _spline3_cac45 if onset != ., cluster(cowcode)
centile mdi, centile(5 95)
margins, atmeans at(mdi=(1.4232(8.184231578947368)156.9236))
marginsplot, scheme(s1mono) title("") ytitle("") xlabel(1.4232 "5 pct" 156.9236 "95 pct") xtitle(Media Density Index) ///  
ylabel(0(0.02)0.1) recastci(rarea) ciopts(fcolor(gs13) lcolor(gs13))  recast(line) ///
name(seven, replace)

logit cci_ons_b mdi lgdpl larea lmtn lpopl oil2l deml deml2 ethfracl relfracl pcyrs_cci _spline1_cci _spline2_cci _spline3_cci if onset != ., cluster(cowcode)
margins, atmeans at(mdi=(1.4232(8.184231578947368)156.9236))
marginsplot, scheme(s1mono) title("") ytitle("") xlabel(1.4232 "5 pct" 156.9236 "95 pct") xtitle(Media Density Index) ///  
ylabel(0(0.02)0.1) recastci(rarea) ciopts(fcolor(gs13) lcolor(gs13))  recast(line) ///
name(eight, replace)

logit cac_ons45_b mdi lgdpl larea lmtn lpopl oil2l deml deml2 ethfracl relfracl pcyrs_cac35 _spline1_cac45 _spline2_cac45 _spline3_cac45 if cci_inc_b == 1 & onset != ., cluster(cowcode)
margins, atmeans at(mdi=(1.4232(8.184231578947368)156.9236))
marginsplot, scheme(s1mono) title("") ytitle("") xlabel(1.4232 "5 pct" 156.9236 "95 pct") xtitle(Media Density Index) ///  
ylabel(0(0.02)0.1) recastci(rarea) ciopts(fcolor(gs13) lcolor(gs13))  recast(line) ///
name(nine, replace)

*Produce Figure 2
graph combine four five six seven eight nine, ysize(6) xsize(9) scheme(s1mono) col(3) iscale(0.5)
graph save figure2, replace



*ONLINE APPENDIX

*Comparison of CONIAS and UCDP/PRIO data

*Download the UCDP Monadic Conflict Onset and Incidence Dataset from: https://www.ucdp.uu.se/downloads/
*Import the UCDP data
import delimited "ucdp-onset-conf-2014.csv", clear

*Merge with CONIAS data
rename gwno cowcode
merge 1:1 cowcode year using "merge.dta"
xtset cowcode year

*Generate annual incidence variables
sort year
by year: egen cci_inc_a = total(cci_inc)
by year: egen cac_inc35_a = total(cac_inc35)
by year: egen cac_inc45_a = total(cac_inc45)
by year: egen uac_inc_a = total(sumconfv414)

*Produce Figure OA1
twoway (line cac_inc35_a year, color(gs0)) (line cac_inc45_a year, color(gs0) lpattern(longdash)) (line uac_inc_a year, color(gs0) lpattern(shortdash)) if year < 2009 & year > 1945, /// 
xlabel(1946(2)2008, angle(45) labsize(vsmall)) xtitle("Year") ytitle("Incidence") ylabel(0(25)125,labsize(small)) ///
scheme(s1mono) legend(label(1 "CONIAS armed conflict (categories 3-5)") label(2 "CONIAS armed conflict (categories 4-5)") label(3 "UCDP/PRIO armed conflict")pos(10) ring(0) col(1))
graph save figureOA1, replace
pwcorr cac_inc35_b incidencev414
kap cac_inc35_b incidencev414
krippalpha cac_inc35_b incidencev414
pwcorr cac_inc45 incidencev414
kap cac_inc45 incidencev414
krippalpha cac_inc45 incidencev414

*Produce Table OA2
*Load BCG data 
use "BCG_squarepegs.dta", clear
xtset cowcode year

*Replicate BCG (2014) Model 2 (Table 1) with full time-span
logit onset01 ethfrac mgini_intx max_rdisc maxhighx maxlowx downatall powershare sip2l lpopl lgdpcapl incidencel, cl(cowcode) nolog
estimates store oa_t3col1

*Replicate with CONIAS 3-5
*Load CONIAS data 
merge 1:1 cowcode year using "merge.dta"
xtset cowcode year
logit cac_ons35_b ethfrac mgini_intx max_rdisc maxhighx maxlowx downatall powershare sip2l lpopl lgdpcapl l.cac_inc35_b, cl(cowcode) nolog
estimates store oa_t3col2

*Replicate with CONIAS 4-5
logit cac_ons45_b ethfrac mgini_intx max_rdisc maxhighx maxlowx downatall powershare sip2l lpopl lgdpcapl l.cac_inc45_b, cl(cowcode) nolog
estimates store oa_t3col3

*Produce Table OA3
esttab oa_t3col1 oa_t3col2 oa_t3col3 using online_appendix.rtf, aic se star(+ 0.10 * 0.05 ** 0.01 *** 0.001) b(%9.3f) onecell nogaps unstack append ///
nodepvars nonumbers eqlabels(none) coeflabel(ethfrac ELF mgini_intx Gini max_rdisc LDG maxhighx PHI maxlowx NHI downatall Downgrade ///
powershare Power-sharing sip2l Democracy lpopl Population lgdpcapl "GDP per capita" /// 
_cons Constant) mlabels ("Expanded BCG" "Expanded BCG CONIAS 3-5" "Expanded BCG CONIAS 4-5") ///
addnotes ("Variables accounting for time-dependence (i.e., one year dependent variable lags) not reported") ///
drop(incidencel L.cac_inc35_b L.cac_inc45_b) ///
title ("Table OA3. Replication of Buhaug, Cederman, and Gleditsch (2014): Comparing CONIAS 3-5 and CONIAS 4-5 to UCDP/PRIO")

*Comparison of CONIAS and NAVCO

*Load CONIAS and NAVCO data
use "merge.dta", replace
xtset cowcode year

*Generate annual incidence variables
sort year
by year: egen cci_inc_a = total(cci_inc)
by year: egen cac_inc35_a = total(cac_inc35)
by year: egen cac_inc45_a = total(cac_inc45)
by year: egen nci_inc_a = total(nci_inc)
by year: egen nac_inc_a = total(nac_inc)

*Produce Figure OA2
twoway (line cci_inc_a year, color(gs0)) (line nci_inc_a year, color(gs0) lpattern(shortdash)) if year < 2007 & year > 1945, /// 
xlabel(1946(2)2006, angle(45) labsize(vsmall)) xtitle("Year") ytitle("Incidence") ylabel(0(25)225,labsize(small)) ///
scheme(s1mono) legend(label(1 "CONIAS incompatibility (categories 1-5)") label(2 "NAVCO campaign (prim_method = 0 or 1)") pos(10) ring(0) col(1))
graph save figureOA2, replace
pwcorr cci_inc_b nci_inc_b
kap cci_inc_b nci_inc_b
krippalpha cci_inc_b nci_inc_b

*Produce Figure OA3
twoway (line cac_inc35_a year, color(gs0)) (line cac_inc45_a year, color(gs0) lpattern(longdash)) (line nac_inc_a year, color(gs1) lpattern(shortdash)) if year < 2007 & year > 1945, /// 
xlabel(1946(2)2006, angle(45) labsize(vsmall)) xtitle("Year") ytitle("Incidence") ylabel(0(25)125,labsize(small)) ///
scheme(s1mono) legend(label(1 "CONIAS armed conflict (categories 3-5)") label(2 "CONIAS armed conflict (categories 4-5)") ///
label(3 "NAVCO violent campaign (prim_method = 0)") pos(10) ring(0) col(1))
graph save figureOA3, replace
pwcorr cac_inc35_b nac_inc_b
kap cac_inc35_b nac_inc_b
krippalpha cac_inc35_b nac_inc_b
pwcorr cac_inc45_b nac_inc_b
kap cac_inc45_b nac_inc_b
krippalpha cac_inc45_b nac_inc_b
